package com.ep.loadingdialog;

import android.app.Dialog;
import android.content.Context;

/**
 * Created by Administrator on 2017/8/11.
 */

public class LoadingDialogUtils {
    private static Dialog mDialog;

    public static void buildLoadingDialog(Context context, int layoutId) {
        if (mDialog == null) {
            mDialog = new Dialog(context, R.style.loading_dialog);
        }
        mDialog.setContentView(layoutId);
        mDialog.setCancelable(true);
        mDialog.getWindow().setBackgroundDrawableResource(android.R.color.transparent);
        mDialog.show();
    }

    public static void cancleLoadingDialog() {
        if (mDialog != null) {
            mDialog.dismiss();
        }
        mDialog = null;

    }
}
